package edu.fzu.costlog.service;

import java.util.List;

import edu.fzu.costlog.dao.CostCategoryDao;
import edu.fzu.costlog.dao.CostCategoryDaoJDBCImpl;
import edu.fzu.costlog.domain.CostCategory;

public class CostCategoryServiceImpl implements CostCategoryService {

	public void saveCostCategory(CostCategory category) {
		
		CostCategoryDao categoryDao = new CostCategoryDaoJDBCImpl();
		categoryDao.addCategory(category);
	}

	public List<CostCategory> loadall() {
		
		CostCategoryDao categoryDao = new CostCategoryDaoJDBCImpl();
		return categoryDao.loadall();
	}

	public void removeCostCategory(Integer categoryId) {
		
		CostCategoryDao categoryDao = new CostCategoryDaoJDBCImpl();
		categoryDao.delLog(categoryId);
	}

	public CostCategory getCostCategoryById(Integer categoryId) {
		
		CostCategoryDao categoryDao = new CostCategoryDaoJDBCImpl();
		return categoryDao.getCategoryById(categoryId);
	}

	public void updateCostCategory(CostCategory category) {
		
		CostCategoryDao categoryDao = new CostCategoryDaoJDBCImpl();
		categoryDao.updateCategory(category);
	}

}
